home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 101-125 / scopedisk122 / bassub / errorhandlers.sub < prev    next >
Text File  |  1995-03-19  |  2KB  |  91 lines

  1. REM Errorhandler
  2. 'Include file of errors which can be trapped
  3. 'Requires Intuits.SUB
  4. 'Program must have a label for recovery called RECOVER:
  5. 'Also includes a break handler for ^C traps which requires label QUIT:
  6. '
  7. error_handler:
  8.     err_no%=ERR
  9.     err_line%=ERL
  10.     SELECT CASE err_no%
  11.         CASE 4
  12.             pgm_err$="Out of Data"
  13.             GOTO exit_handler
  14.         CASE 6
  15.             pgm_err$="Overflow"
  16.             GOTO exit_handler
  17.         CASE 7
  18.             LIBRARY CLOSE
  19.             CLOSE
  20.             END
  21.         CASE 11
  22.             pgm_err$="Division by Zero"
  23.             GOTO exit_handler
  24.         CASE 49
  25.             pgm_err$="Volume Not Found"
  26.             GOTO exit_handler
  27.         CASE 52
  28.             pgm_err$="Bad File Number"
  29.             GOTO exit_handler
  30.         CASE 53
  31.             pgm_err$="File Not Found"
  32.             GOTO exit_handler
  33.         CASE 54
  34.             pgm_err$="Bad File Mode"
  35.             GOTO exit_handler
  36.         CASE 55
  37.             pgm_err$="File Already Open"
  38.             GOTO exit_handler
  39.         CASE 57
  40.             pgm_err$="Device I/O Error"
  41.             GOTO exit_handler
  42.         CASE 61
  43.             pgm_err$="Disk Full"
  44.             GOTO exit_handler
  45.         CASE 64
  46.             pgm_err$="Bad File Name"
  47.             GOTO exit_handler
  48.         CASE 67
  49.             pgm_err$="Directory Full"
  50.             GOTO exit_handler
  51.         CASE 70
  52.             pgm_err$="Disk Write Protected"
  53.             GOTO exit_handler
  54.         CASE 75
  55.             pgm_err$="Path/File Access Error"
  56.             GOTO exit_handler
  57.         CASE 76
  58.             pgm_err$="Path Not Found"
  59.             GOTO exit_handler
  60.         CASE ELSE
  61.             pgm_err$="Err No. "+STR$(err_no%)+" at Line "+STR$(err_line%)
  62.             GOTO exit_handler
  63.     END SELECT
  64.  
  65. exit_handler:
  66.     BoxIndex%=1
  67.     CALL EasyAlert("***** Program Error *****",pgm_err$,which%)
  68.     IF which%=2 THEN
  69.         WINDOW OUTPUT 1
  70.         CLOSE
  71.         RESUME quit
  72.     END IF
  73.     WINDOW OUTPUT 1
  74.     CLOSE
  75.     ON ERROR GOTO error_handler
  76.     RESUME recover
  77.  
  78. break_handler:
  79.     BoxIndex%=1
  80.     BREAK OFF
  81.     CALL EasyAlert("Control-C Break","Exit Program?",which%)
  82.     IF which%=1 THEN
  83.         ON BREAK GOSUB break_handler
  84.         BREAK ON
  85.         CLS
  86.         GOTO recover
  87.     END IF
  88.     CLOSE
  89.     GOTO quit
  90. RETURN
  91.